<?php
require_once 'BaseModel.class.php';
class QGCategoryModel extends BaseModel {
	/**
	* @var Logger
	*/
	private $_logger;

	public function __construct() {
		parent::__construct();
		Logger::configure(ROOT_PATH.'config/log_config.xml');
		$this->_logger = Logger::getLogger(__CLASS__);
	}

	/**
	* @return CLIST
	*/
	public function getAll() {
		$list = new CLIST();
		$query = 'SELECT id, catname FROM qgcategories ORDER BY refcount DESC';
		$conn = DBHelper::getDB(false);
		$resultSet = $conn->select($query);
		for ($i=0; $i<count($resultSet); $i++) {
			$map = new CMAP($resultSet[$i]);
			$list->append($map);
		}
		return $list;
	}
}